﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Go.Model;
using Go.Tools;
namespace GoUnitTest
{
    class MockComputerPlayer: ComputerPlayer
    {
        protected LinkedList<Position> _listCoordinatesToPlay;

        public LinkedList<Position> ListCoordinatesToPlay
        {
            get { return _listCoordinatesToPlay; }
            set { _listCoordinatesToPlay = value; }
        }

        public MockComputerPlayer(LinkedList<Position> aListCoordinateToPlay, Color aColor, String name)
            : base(aColor, name)
        {
            _listCoordinatesToPlay = aListCoordinateToPlay;
        }

        public override void play() {
            if (_listCoordinatesToPlay.Count == 0)
            {
                base.play();                
            }
            else
            {
                Position aPositioToPlay = _listCoordinatesToPlay.First.Value;
                _listCoordinatesToPlay.RemoveFirst();
                if (aPositioToPlay != null)
                    this.putStone(aPositioToPlay);
            }
        }
           
    }
}
